package com.cleaningcloud.erp.mapper;

import java.util.List;

import com.cleaningcloud.erp.api.domain.ErpCommodityStockAlter;
import com.cleaningcloud.erp.domain.ErpWareAllocate;
import com.cleaningcloud.erp.domain.ErpWareAllocateDetails;
import com.cleaningcloud.erp.domain.vo.ErpWareAllocateVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;

/**
 * 调拨Mapper接口
 * 
 * @author cleaningcloud
 * @date 2024-10-08
 */
public interface ErpWareAllocateMapper 
{
    /**
     * 查询调拨
     * 
     * @param wareAllocateId 调拨主键
     * @return 调拨
     */
    ErpWareAllocateVo selectErpWareAllocateByWareAllocateId(Long wareAllocateId);

    /**
     * 查询调拨列表
     * 
     * @param erpWareAllocate 调拨
     * @return 调拨集合
     */
    List<ErpWareAllocateVo> selectErpWareAllocateList(ErpWareAllocate erpWareAllocate);

    /**
     * 新增调拨
     * 
     * @param erpWareAllocate 调拨
     * @return 结果
     */
    int insertErpWareAllocate(ErpWareAllocate erpWareAllocate);

    /**
     * 修改调拨
     * 
     * @param erpWareAllocate 调拨
     * @return 结果
     */
    int updateErpWareAllocate(ErpWareAllocate erpWareAllocate);

    /**
     * 删除调拨
     * 
     * @param wareAllocateId 调拨主键
     * @return 结果
     */
    int deleteErpWareAllocateByWareAllocateId(Long wareAllocateId);

    /**
     * 批量删除调拨
     * 
     * @param wareAllocateIds 需要删除的数据主键集合
     * @return 结果
     */
    int deleteErpWareAllocateByWareAllocateIds(Long[] wareAllocateIds);

    /**
     * 批量新增库存调拨明细
     * @param list
     */
    void batchInsertWareAllocateDetails(@Param("list")List<ErpWareAllocateDetails> list);

    /**
     * 根据库存调拨id批量擅长明细
     * @param wareAllocateId
     */
    @Delete("delete from `cleaningcloud-erp`.erp_ware_allocate_details where ware_allocate_id = #{wareAllocateId}")
    void deleteWareAllocateDetailsByWareAllocateId(@Param("wareAllocateId") Long wareAllocateId);

    /**
     * 获取调拨数量
     * @param erpCommodityStockAlter
     */
    Integer getDbNumber(ErpCommodityStockAlter erpCommodityStockAlter);
}
